<%-- 优车处置流程附加页面控制逻辑 --%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<script type="text/javascript">
    var keyNodes = {};
    keyNodes['001'] = 'FLOW_0000_019_001_001';//评估师估价
    keyNodes['003'] = 'FLOW_0000_019_001_003';//车辆上拍
    keyNodes['004'] = 'FLOW_0000_019_001_004';//销售合同签署通知打款
    keyNodes['005'] = 'FLOW_0000_019_001_005';//商助确认车正到款
    keyNodes['006'] = 'FLOW_0000_019_001_006';//财务部确认来款
    keyNodes['007'] = 'FLOW_0000_019_001_007';//呈报人添加提车人信息
    keyNodes['008'] = 'FLOW_0000_019_001_008';//资产管理员出库登记
    keyNodes['009'] = 'FLOW_0000_019_001_009';//系统管理员审核出库
    keyNodes['011'] = 'FLOW_0000_019_001_011';//财务做账
    keyNodes['012'] = 'FLOW_0000_019_001_012';//发送网银（处置车款）异常
    keyNodes['013'] = 'FLOW_0000_019_001_013';//财务核查原因（处置车款）
    keyNodes['014'] = 'FLOW_0000_019_001_014';//资产管理员复核费用
    var taskDefKey = '${taskDefKey}';

    $(function () {

        if (taskDefKey == keyNodes['001']) {
            $("span[onclick*='editAssessAmt']").removeClass("Hide");
        }

        if (taskDefKey == keyNodes['003']) {
            $("span[onclick*='editDealSell']").removeClass("Hide");
        }

        if (taskDefKey == keyNodes['004']) {
            $("span[onclick*='editBuyerCode']").removeClass("Hide");
            $("span[onclick*='editPayInfo']").removeClass("Hide");


            $("#payInfoDataGrid").ligerGrid({
                onBeforeShowData: function (currentData) {
                    $.each(currentData.rows, function(index, value) {
                        value.hide = true;
                    });
                    return currentData;
                }
            });
            $("#payUploadDiv").removeClass("Hide");
            $("#ligergrid_file2").ligerGrid({
                onBeforeShowData: function (currentData) {
                    $.each(currentData.rows, function(index, value) {
                        value.hide = true;
                    });
                    return currentData;
                }
            });

            $("span[onclick*='editReceiveInfo']").removeClass("Hide");

            enablePickEdit();
        }

        if (taskDefKey == keyNodes['005']) {
            $("span[onclick*='editAccStsCd']").removeClass("Hide");
        }

        if (taskDefKey == keyNodes['006']) {
            var url = basePath + "/ass/ucardeal/toAddFundPage.do?dealSellId=" + dealId;
            $('<iframe frameborder="0" name="capFundAddBindIframe" id="capFundAddBindIframe"></iframe>').appendTo($("#capFundBindDiv"));
            $("#capFundAddBindIframe").attr("src", url);
            var iframe = document.getElementById("capFundAddBindIframe");
            if (iframe.attachEvent) {
                iframe.attachEvent("onload", function() {
                    $("#capFundBindDiv").height(iframe.contentWindow.document.documentElement.scrollHeight);
                });
            } else {
                iframe.onload = function() {
                    $("#capFundBindDiv").height(iframe.contentWindow.document.documentElement.scrollHeight);
                };
            }
        }

        if (taskDefKey == keyNodes['007']) {
            enablePickEdit();
        }

        if (taskDefKey == keyNodes['008']) {
            $("a[onclick*='entryOrder']").removeClass("Hide");
        }

        if (taskDefKey == keyNodes['013']) {
            $("span[onclick*='editBfsPayInfo']").removeClass("Hide");
        }

        if (taskDefKey == keyNodes['014']) {
            top.$.ligerDialog.SQalert({
                content: "<font color=\"red\" style=\"font-weight:bold;\">此节点为提报费用节点，请务必仔细核查是否需要发起相关费用借款，避免车辆处置完成后无法绑定该资产。</font>",
                SQ_showButtons: true,
                SQ_type: "warning"
            });
            $("span[onclick*='toEditCost']").removeClass("Hide");
            $("#ligergrid2").ligerGrid({
                onBeforeShowData: function (currentData) {
                    $.each(currentData.rows, function(index, value) {
                        value.hide = true;
                    });
                    return currentData;
                }
            });
        }
    });

    // 启用提车人信息编辑
    function enablePickEdit() {
        $("span[onclick*='editSellPickInfo']").removeClass("Hide");
        $("#pickCarUploadDiv").removeClass("Hide");
        $("#ligergrid_file3").ligerGrid({
            onBeforeShowData: function (currentData) {
                $.each(currentData.rows, function (index, value) {
                    value.hide = true;
                });
                return currentData;
            }
        });
    }

</script>